#include "base64_new.h"
#include <iostream>
#include <fstream>


using namespace std;

int main() {
  const string s = "ADP GmbH\nAnalyse Design & Programmierung\nGesellschaft mt beschränkter Haftung" ;
  string df;
  filebuf fb;
  fb.open ("/tmp/work_03.09.2008_10.43.12.pdf",ios::in);
  istream is(&fb);
  while (is.good())     // loop while extraction from file is possible
  {
  df += char(is.get());
  }
  fb.close();

  string encoded = base64_encode(reinterpret_cast<const unsigned char*>(df.c_str()), df.length());
  string decoded = base64_decode(encoded);

  ofstream myfile;
  myfile.open ("base64.txt");
  myfile << encoded << endl;
  myfile.close();

  myfile.open ("norm.pdf");
  myfile << decoded << endl;
  myfile.close();

  cout << "encoded: " << encoded << std::endl;
  cout << "decoded: " << decoded << std::endl;

  return 0;
}

